package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.domain.LogiWaybillValueAdd;

import java.util.List;

/**
 * 运单增值服务Mapper接口
 */
public interface LogiWaybillValueAddMapper extends BaseMapperPlus<LogiWaybillValueAdd> {

    default void updateByUK(LogiWaybillValueAdd logiWaybillValueAdd) {
        update(logiWaybillValueAdd, Wrappers.<LogiWaybillValueAdd>lambdaUpdate()
                .eq(LogiWaybillValueAdd::getDeptId, logiWaybillValueAdd.getDeptId())
                .eq(LogiWaybillValueAdd::getWaybillId, logiWaybillValueAdd.getWaybillId()));
    }

    default void removeByUK(Long deptId, Long waybillId) {
        delete(Wrappers.<LogiWaybillValueAdd>lambdaQuery()
                .eq(LogiWaybillValueAdd::getDeptId, deptId)
                .eq(LogiWaybillValueAdd::getWaybillId, waybillId));
    }

    default List<LogiWaybillValueAdd> selectByWaybillIds(List<Long> waybillIds) {
        return selectList(Wrappers.<LogiWaybillValueAdd>lambdaQuery().in(LogiWaybillValueAdd::getWaybillId, waybillIds));
    }
}
